import json


def convert(file_path, out_path):
    with open(out_path, 'w+', encoding='utf-8') as f:
        data = open(file_path, encoding='utf-8')
        for line in data:
            line = json.loads(line)
            line = line['abst'] + '|' + line['title'] + '\n'
            f.write(line)
        # data = data.replace('title','tgt').replace('abst','src')
        # f.write(data)


convert('./csl_title_dev.json', 'dev2.json')
convert('./csl_title_train.json', 'train2.json')
